﻿using System.Drawing;
using System;

namespace RoiControllers
{
    public class ShapeUpdateEvents:IDisposable
    {
        /// <summary> 形状选中 </summary>
        protected Action<ShapeBase, PointF> SelectedEvents;
        /// <summary> 形状移动 </summary>
        protected Action<ShapeBase, PointF> MoveEvents;
        /// <summary> 形状旋转 </summary>
        protected Action<ShapeBase, PointF> RotateEvents;
        /// <summary> 形状调整大小 </summary>
        protected Action<ShapeBase, PointF> ResizeEvents;
        /// <summary> 形状附加 </summary>
        protected Action<ShapeBase, PointF> AttachEvents;
        /// <summary> 形状移除 </summary>
        protected Action<ShapeBase, PointF> DetachEvents;

        #region 事件方法
        #region 订阅
        /// <summary> 订阅方法：选中方法 </summary>
        public void OnSelected(Action<ShapeBase, PointF> callback)
        {
            SelectedEvents += callback;
        }
        /// <summary> 订阅方法：移动方法 </summary>
        public void OnMove(Action<ShapeBase, PointF> callback)
        {
            MoveEvents += callback;
        }
        /// <summary> 订阅方法：旋转方法 </summary>
        public void OnRotate(Action<ShapeBase, PointF> callback)
        {
            RotateEvents += callback;
        }
        /// <summary> 订阅方法：调整大小方法 </summary>
        public void OnResize(Action<ShapeBase, PointF> callback)
        {
            ResizeEvents += callback;
        }
        /// <summary> 订阅方法：添加形状方法 </summary>
        public void OnAttach(Action<ShapeBase, PointF> callback)
        {
            AttachEvents += callback;
        }
        /// <summary> 订阅方法：移除形状方法 </summary>
        public void OnDetach(Action<ShapeBase, PointF> callback)
        {
            DetachEvents += callback;
        }
        #endregion

        #region 取消订阅
        /// <summary> 取消订阅方法：选中方法 </summary>
        public void UnSelected(Action<ShapeBase, PointF> callback)
        {
            SelectedEvents -= callback;
        }
        /// <summary> 取消订阅方法：移动方法 </summary>
        public void UnMove(Action<ShapeBase, PointF> callback)
        {
            MoveEvents -= callback;
        }
        /// <summary> 取消订阅方法：旋转方法 </summary>
        public void UnRotate(Action<ShapeBase, PointF> callback)
        {
            RotateEvents -= callback;
        }
        /// <summary> 取消订阅方法：调整大小方法 </summary>
        public void UnResize(Action<ShapeBase, PointF> callback)
        {
            ResizeEvents -= callback;
        }
        /// <summary> 取消订阅方法：附加方法 </summary>
        public void UnAttach(Action<ShapeBase, PointF> callback)
        {
            AttachEvents -= callback;
        }
        /// <summary> 取消订阅方法：卸载方法 </summary>
        public void UnDetach(Action<ShapeBase, PointF> callback)
        {
            DetachEvents -= callback;
        }
        #endregion

        #endregion
        public void Dispose() { }
    }
}
